
<Widget:show col="12" title="表单字段创建说明">
	1.默认情况下AcAdmin能自动创建ApiCloud对象现在有的字段
    2.如果ApiCloud对象内容为空则获取不了字段,需要手动添加
	3.表单设计完成后,请生成表单.
	<p>
		使用前请先创建ApiCloud对象<br />
		<code>
			对象名:ac_model
			字段:
			name,title,fields,cache;
		</code>
	</p>
</Widget:show>

<Widget:show col="12" title="{$name},字段列表">
	<Widget:action id="gridObj-action">
        <a data-pjax class="btn blue" href="{:U('AcForm/index')}">返回</a>
        <a ajax-dialog class="btn blue" href="{$addUrl}&id={$id}">新增字段</a>
        <a data-ajax class="btn blue" href="{:U('AcFormField/create')}&id={$id}">生成表单</a>
	</Widget:action>
	<div class="table-scrollable">
		<table id="gridObj" class="table table-striped table-bordered table-advance table-hover">
			<thead>
                <th w_index="name">字段名称</th>
                <th w_index="label">标签</th>
                <th w_index="type">表单类型</th>
    			<th w_index="actype">ApiCloud对象类型</th>
                <th w_index="showList">列表页显示</th>
                <th w_index="showAdd">新增页显示</th>
                <th w_index="showEdit">修改页显示</th>
    			<th ></th>
            </thead>
            <tbody>
            <volist name="data" id="v">
                <tr>
                    <td>{$v.name}</td>
                    <td><a data-editable data-name="label" data-value="{$v.label}" data-pk="{$v.name}" href="#">{$v.label}</a></td>
                    <td><a data-type="select" data-editable-ipttype data-name="type" data-value="{$v.type}" data-pk="{$v.name}" href="#"></a> </td>
                    <td><a data-type="select" data-editable-actype data-name="actype" data-value="{$v.actype}" data-pk="{$v.name}" href="#"></a> </td>

                    <td><a data-type="select" data-editable-isshow data-name="showList" data-value="{$v.showList}" data-pk="{$v.name}" href="#"></a></td>
                    <td><a data-type="select" data-editable-isshow data-name="showAdd" data-value="{$v.showAdd}" data-pk="{$v.name}" href="#"></a></td>
                    <td><a data-type="select" data-editable-isshow data-name="showEdit" data-value="{$v.showEdit}" data-pk="{$v.name}" href="#"></a></td>
                    <td>
                        <a data-delete class="btn btn-xs red" href="{:U("AcFormField/delete?name=$v[name]&id=$id")}">删除</a>
                    </td>
                </tr>
            </volist>
            </tbody>

		</table>
	</div>
</Widget:show>
<script type="text/javascript">
$(function(){
    $.fn.editable.defaults.url = "{:U('AcFormField/updateField')}&mName={$mName}";
    $('[data-editable]').editable();

    $('[data-editable-isshow]').editable({
        prepend: "隐藏",
        source: [
            {value: '1', text: '显示'},
            {value: '0', text: '隐藏'},
        ]
    });

    $('[data-delete]').confirmation({
        container: 'body',
        href:false,
        onConfirm:function(event, element){
            event.preventDefault();
            el  = $(element);
            var url = el.attr('href');
            $.get(url,function(req){
                $.bootstrapGrowl(req.info);
                var st = req.status;
                $.pjax.reload('[data-pjax-container]');
            })
        }
    });


    $('[data-editable-ipttype]').editable({
        prepend: "请选择",
        source: [
            {value: 'text', text: 'text'},
            {value: 'select', text: 'select'},
            {value: 'date', text: 'date'},
            {value: 'time', text: 'time'},
            {value: 'datetime', text: 'datetime'},
            {value: 'hidden', text: 'hidden'},
            {value: 'textarea', text: 'textarea'},
            {value: 'editor', text: 'editor'},
            {value: 'file', text: 'file'},
        ]
    });

    $('[data-editable-actype]').editable({
        prepend: "请选择",
        source: [
            {value: 'String', text: 'String'},
            {value: 'Number', text: 'Number'},
            {value: 'Boolean', text: 'Boolean'},
            {value: 'Date', text: 'Date'},
            {value: 'File', text: 'File'},
            {value: 'Array', text: 'Array'},
            {value: 'Object', text: 'Object'},
            {value: 'GeoPoint', text: 'GeoPoint'},
            {value: 'Pointer', text: 'Pointer'},
            {value: 'Relation', text: 'Relation'},
        ]
    });
})
</script>
